Basic Programmer's Toolkit

A selection of utilities to aid the process of writing programs in Basic

Note: clicking on references from the following list will take you to the appropriate section, whilst clicking on the main headings within the manual will return the view to this list of contents. Clicking on screenshots will open full-size versions in new browser windows.

Contents

Introduction  
Basic Print Program Printer
Basic Format Program Formatter
SWI Manager SWI name/number converter and lister
Basic Analyser Program Analyser
Basic Crunch Program Cruncher
Basic Differentiator Program Differentiator
Basic Help Desktop Front End for HELP command
Basic Monitor Program Monitor
Library Manager Procedure Library Manager
Basic Library Library of Basic routines

Introduction

The Basic Programmer's Toolkit consists of ten applications which are all designed to help users who program in Basic, and are suitable for beginners and experienced programmers alike. In most cases they have been written because the author himself had a need for just such a utility when developing his own programs, so the facilities they provide are very much based on real day-to-day experience of programming. In addition, the disc contains a library of useful Basic routines.

All the applications presented on this disc are multi-tasking, reflecting the tendency of most programmers nowadays to develop software on the Desktop using an editor such as DeskEdit or the RISC OS 3 version of Edit. However, they can all be used in the development of any Basic program, whether multi-tasking or not.

Also supplied on the disc is an application called BasicTK which provides a menu system and front end for the other applications on the disc. Running this application enables you to display on-screen instructions for each of the other applications, and to install them directly from the menu system. If you choose not to use BasicTK, all the applications can be run in the usual RISC OS fashion, by double-clicking on the application's icon in a directory viewer.

In all cases except one, running the application, either from the menu system or from a directory viewer, results in the application being installed on the icon bar (the exception is Basic Differentiator which simply opens a window on the Desktop). In most cases, clicking Select on the icon bar icon will open the main window. Detailed instructions on how to use each application are given in a !Help file within the application directory, and can also displayed by the menu system when BasicTK is used. The purpose of this manual is to give an overview of each item on the disc.

Basic Program Printer

by Graham Crow
Basic Program PrinterBasic Print is a printer driver designed to simplify the task of printing Basic programs and some other types of file. It will print Basic files (&FFB), with indent options, and also Text (&FFF), Command (&FFE) and Obey (&FEB) files. It prints in the background, leaving the computer free for other tasks; it will print marked sections; and there is a multi-column facility which enables you to print listings in several columns across the page. There are many other features which allow a great deal of flexibility in the way you print your listings.

Using Basic Print

To print a program or file, drag its icon from a Filer window into Basic Print's window or onto the icon bar icon. The window is in four sections. At the top are shown details of the file. If it is a Basic program the first and last line numbers are shown.

The second section of the window provides facilities for printing in multi-column format. You may choose the number of columns, and also the number of lines per page and characters per line, to allow you to use different paper and typeface sizes.

The third section enables you to choose between printing the whole file, a specific range of lines, or a marked section. The remaining window section contains the action icons to enable you to perform the printing operation.

Clicking Menu over the main window opens a second window, which is the Settings window. This allows you to specify the codes that your printer will recognise for various functions such as bold, superscript etc. The Settings window has a menu of its own which allows you to load and save settings files, and control the settings in other ways.

Basic Program Formatter

by Graham Crow
Basic Program FormatterMany Basic programs are 'packed' by eliminating all inessential spaces and by including as many statements as possible (separated by colons) on each line. While this saves space and may also reduce execution time, it does not make for legibility! The application presented here, Basic Formatter, allows you to reverse this process and save the modified program under a different name. It also provides the means of improving the appearance of listings by indenting lines and structures (eg. FOR...NEXT loops).

Using Basic Formatter

To format a program, drag its icon from a directory viewer into the window or onto the icon bar icon. Details of the file (its pathname, length in bytes, and first and last line numbers) will appear in the top section of the window.

The second section of the window allows you to choose the formatting options, which are (i) to indent lines by n spaces; (ii) to indent structures by n spaces; (iii) to split multi-statement lines; (iv) to insert extra spaces. With the first two options, you can specify the number of spaces by which to indent. Any or all of these options can be selected together.

Basic Formatter is multi-tasking, so you may work with other Desktop tasks whilst processing is taking place. While the formatting process is in operation a percentage figure indicates how far the process has reached.

Click on OK to start processing. Once the formatting is finished, you may save the modified program by dragging the Basic icon to a Filer window.

SWI Manager

by Alan Wrigley
SWI ManagerSWI Manager is a comprehensive aid for programmers which enables you to convert any SWI name to its corresponding number and vice versa; to convert all the SYS calls in a Basic program to names, numbers or variables; or to list all the SWIs currently known to your computer.

Converting the SYS calls in a Basic program to names allows you to read the program more easily.

Conversely, converting all the SYS calls to numbers ensures that they operate more quickly and generally use up less memory.

Converting to variables gives the best of both worlds. The program is instantly readable, but the speed of operation will be little different from that achieved when using numbers.

Using SWI Manager

The program's main window is in three sections. The upper section is headed Single conversion, and allows you to convert a SWI name into a number, or vice versa, by typing the required name or number directly into the window.

The central section of the window is headed Program conversion. Dragging a Basic program into the window or onto the icon bar icon will convert all SYS calls in that program to names, numbers or variables according to the state of the radio icons in the window at the time the file was dragged.

The final section of the window is entitled SWI list, and allows you to list all the SWIs currently known to your computer (i.e. all those recognised by modules which are currently resident). You may specify the start and end SWI numbers for the search. The results of the search are displayed in a second window, the contents of which can be dumped to a printer if required.

Basic Program Analyser

by Graham Crow
Basic Program AnalyserBasic Analyser scans a Basic program byte by byte to carry out a detailed analysis. You can select the particular analysis you want from among the following:

  1. Analyse Procedures and Functions:
  2. Analyse variables (whether or not they have been declared)
  3. Measure the length of sections by line numbers or markers

The listings resulting from (1) and (2) may be saved as a text file.

Using Basic Analyser

To analyse a program, drag its file from a directory viewer onto the window or the icon bar icon. Details of the current file will appear in the top section of the window. The second section of the window allows you to choose which analysis options you require, as described above.

Clicking on the OK icon in the Process section of the window starts the process of program analysis. Depending on the options chosen, the process may need one pass or two. Progress is reported in the window as the operation takes place. Basic Analyser is multi-tasking, so you can perform other Desktop tasks while processing takes place. Once the process is completed you can save the result as a text file by entering the required filename and dragging the file icon to a directory viewer in the usual way.

To measure the length of a program section, use the bottom area of the window. You can choose between specifying line numbers and using markers. Basic Analyser will give you the length of the section in bytes.

Basic Program Cruncher

by Graham Crow
Basic Program CruncherThe resident Basic command CRUNCH removes specified spaces from the current program. It is a fast and powerful command, but its usefulness is limited by the fact that you need to be in Basic with the target program loaded before you can issue the command. Basic Crunch enables you to use CRUNCH from the Desktop, by dragging a Basic program onto the application, and saving the crunched version in the same way. All the options which are normally available with the CRUNCH command are also available with Basic Crunch.

Using Basic Crunch

To crunch a program, drag its file from a directory viewer onto Basic Crunch's window or its icon bar icon. Details of the file appear in the top section of the window, and the default name appears in the Save as: section of the window.

Choose the crunch option(s) you require from the following:

Any or all of the options may be selected at the same time, and each option causes the specified elements to be removed from the program.

To crunch the program all you need to do is to save the file in the usual way, either by clicking on OK or pressing Return to save with the default filename, or by dragging the icon to a directory viewer.

Basic File Differentiator

by Lewis G. Kirby
Basic File DifferentiatorBasic Differentiator is an application which finds the differences between two Basic programs. It is not a simple file comparator; it actually shows which lines have been deleted from, inserted into, or simply changed in the first program in order to produce the second. Running the application displays a dialogue box into which the user drags the two program files; the resulting difference file may then be saved.

The difference file is actually a Command (*Exec) file which will, if executed, load the first program, delete lines which were in the first but not in the second, insert lines which were either not in the first or were changed, and save the resulting changed program using the filename of the second program.

The application can be used to determine whether and where a program has differed from one version to the next; to provide updates for users of your code; or to maintain a series of Delta files for your programs.

Using Basic Differentiator

To use the application, first drag the original program into the dialogue box, followed by the second, changed version, as prompted at the foot of the window. When the differences have been determined, a "Save as:" prompt appears, allowing you to save the difference file in the usual way, either by dragging the icon to a directory viewer or by clicking on OK.

The difference file consists of comments (preceded by "*|") and Basic commands and statements. The comments include the names of the two files and the date the differencing was done.

The second (changed) file may now be deleted if required, as it can be reproduced simply by double-clicking on the difference file icon in a directory viewer.

Basic Differentiator can be customised in various ways to suit individual requirements. This is detailed in the application's help file.

Basic Help

by Alan Wrigley
This application can only be run under RISC OS 3
Basic HelpThe Basic command HELP provides help on any other Basic keyword, and can often be useful when developing a program to remind yourself of the use of, or parameters to be used with a particular keyword without reaching for the manual. Unfortunately it is only available from the Basic prompt outside the Desktop.

The application described here, Basic Help, enables you to use the facilities of HELP from the Desktop, either by selecting the keyword you want from a list or by typing it into a dialogue box. The application also allows you to enter a Basic error number and see the error message associated with it.

Using Basic Help

Clicking on the icon bar icon opens a window which lists all the keywords currently known to Basic. Clicking over any keyword in the list opens a smaller help window which displays Basic's help message for the keyword in question.

You can also activate the help window by using the Keyword menu option from Basic Help's icon bar menu. This enables you to type any keyword into a writable icon and display the help message for that word. The menu also has an Error option, which allows you to enter a Basic error number (0-112) and display the error message which corresponds to that number.

Basic Program Monitor

by Graham Crow
Basic Monitor is a multi-tasking monitor specifically designed to view Basic programs in memory, either as a pure byte dump (i.e. similar to the conventional hex dump obtained by using the command *Dump on a file), or in decoded format. The latter shows one byte per line giving the address (in hex and decimal) followed by the contents (hex, decimal and binary) followed by the interpreted contents (e.g. a Basic token, a printable ASCII character, an element of a line number etc.).

Using Basic Monitor

Dragging a Basic file from a directory viewer into Basic Monitor's window or onto its icon bar icon opens two windows, the upper one showing the display (initially in dump mode) and the lower one showing the Basic Monitor tools.

The tools window has four sections. The left section allows you to switch between dump and decoded modes, and to alter the number of bytes per line for the former, within the range 1-32.

The second section enables you to jump to an address or line number. You can also alter the notional address of PAGE from its default of &8F00. This section shows the length of the current program.

The third section of the tools window allows you to send the dump to your printer without the need for printer drivers. The Set print option enables you to set the printout to start at the current top of the display window, while a writable icon allows you to specify how many lines are to be printed at a time, to prevent the printer buffer from filling up.

The fourth window section contains a set of arrow icons which enable you to scroll the program display up or down a line, or move to the start or end of the program.

Procedure Library Manager

by Carl Edwards
The Procedure Library Manager helps programmers to manage a library of regularly-used procedures and functions, enabling library functions to be extracted from a program file and either saved individually or appended to other programs. It also allows documentation for the given routine to be viewed (and saved if desired).

Library routines, which are simply chunks of Basic with no special headers or codes required, are kept in a set of subdirectories within Library Manager. A further set of matching subdirectories can be kept which contain documentation on each of the routines in the form of text files. You can add any subdirectories you wish to the library, or rename or delete any which are there already, since Library Manager reads the directory catalogue when starting up. However, if any of the subdirectories is empty an error will be generated. Documentation files should have exactly the same name as the routine to which they refer.

Using the Library Manager

Clicking Menu over the icon bar icon displays a menu containing five options, including the usual Info and Quit options, plus Routine, Append and Save as.

Routine leads to a submenu displaying the names of all the library sections. Each of these entries leads us to a submenu listing all of the routines in that section. Choosing a routine from one of these submenus results in the documentation for that routine being displayed in a window.

Append appends the currently selected routine to the current program. The current program is set by dragging its icon to the icon bar icon. A beep is generated when this has been done. If no program has been selected as the current program then this entry is greyed out.

Save as leads to a standard RISC OS save box, allowing the currently selected routine to be saved as a file. This entry is greyed out unless a routine is selected.

If the documentation window has been closed, it can be re-opened by clicking Select over the icon bar icon. Clicking Menu over the documentation window results in the same menu being displayed as for the icon bar icon, except that the save box allows the documentation to be saved, rather than the routine itself.

Library of Basic Routines

by various authors
A library of Basic routines is supplied on this disc, containing procedures and functions which you can use as ready-made routines in your own programs. Some of these routines are specific to Wimp programs, while others are also suitable for non-multi-tasking programs.

The library is organised in the following way:

The directory !BasicLib.Procedures contains a number of subdirectories, each containing a number of separate program files. The subdirectory name provides a generic title for the routines contained therein, e.g. WimpLib or Filing.

Each of the subdirectories, and the files contained in them, are mirrored in a second directory, !BasicLib.Documents, which provides documentation on the routines in the form of text files.

The library has been organised in this way to make it suitable for use with the Procedure Library Manager elsewhere on this disc.




Copyright © Beebug Limited 1998

All rights reserved

BasAnalys, BasCrunch, BasDiffer, BasFormat, BasHelp, BasicLib, BasMonit, BasPrint, LibMngr and SWIMngr are all Copyright © Beebug Ltd 1998.

The RISC User Menu System, BasicTK, is Copyright © Lee Calcraft 1998.

No part of this product may be reproduced in whole or part by any means without written permission of the publisher or copyright holder. Unauthorised hiring, renting, loaning, public performance or broadcasting of this product or its constituent parts is prohibited.

While every care is taken, the publisher cannot be held responsible for any errors in this product, or for the loss of any data or consequential effects from the use of this package.

Published by Beebug Ltd
117 Hatfield Road, St. Albans, Herts AL1 4JS, England.
Tel: 01727 843600  Fax: 01727 890263

Please address all correspondence regarding this product to the Publications Department at the above address.

This manual was edited and typeset entirely using Beebug's DeskEdit text editor and Ovation Desktop Publisher